package cn.gcjxsc.payment.messaging.source;

import cn.gcjxsc.common.data.notify.redpack.RedPackResultData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.Output;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.support.MessageBuilder;

/**
 * @author pumbaa
 * @since 1.0
 */
@EnableBinding(RedPackResultSource.Source.class)
public class RedPackResultSource {
    @Autowired
    private Source source;

    public void sendRedPackResultMessage(RedPackResultData data) {
        source.output().send(MessageBuilder.withPayload(data).build());
    }

    public interface Source {
        String QUEUE_NAME = "rw_machine_wx_redpack_result_output";

        @Output(QUEUE_NAME)
        MessageChannel output();
    }
}
